package com.atguigu.yygh.oss.controller;

import com.atguigu.yygh.oss.service.OSSService;
import com.atguigu.yygh.result.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/*==========================================
      时 间:   2022-04-24
      讲 师:   刘  辉
      描 述:   尚硅谷教学团队
 ==========================================*/
@RestController
@RequestMapping("/admin/oss/file")
public class OSSController {

    @Autowired
    private OSSService ossService;

    @PostMapping("/upload")
    public R upload(MultipartFile file){
       String url= ossService.upload(file);
       return R.ok().data("url",url);
    }
}
